package com.jumper.property.comparer.diff.getter;

import com.jumper.property.comparer.diff.DiffVal;
import com.jumper.property.comparer.diff.DiffVisitor;
import com.jumper.property.comparer.diff.Element;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public abstract class AbstractDiffGetter<T> implements DiffVisitor<T>, DiffGetter<T> {

    private final List<DiffVal> diffs = new ArrayList<>();

    @Override
    public List<DiffVal> getDiffs(Element<T> element) {
        visit(element);
        return diffs;
    }

    protected void addDiffs(Collection<DiffVal> diffs) {
        this.diffs.addAll(diffs);
    }
}
